var rid = window.location.search.split("=")[1];
function prform() {
	document.getElementById("printb").style.visibility = "hidden";
	window.print();
	window.location.href = "cngDatachk.jsp";
	//document.getElementById("rep").style.visibility = "visible";
}
function rep(){
	window.location.href = "cngDatachk.jsp";
}
Ext.onReady(function() {
	Ext.Ajax.request({
		url : "getChkById.do",
		params : {
			rid : rid
		},
		success : function(response) {
			var res = Ext.decode(response.responseText);
			var ind = document.getElementsByTagName("input");
			for (var key in res) {
				for (var i = 0; i < ind.length; i++) {
					var pagid = ind[i].id;
					if (pagid == key) {
						if (pagid == "startDate" || pagid == "endDate"
								|| pagid == "xstartDate" || pagid == "xendDate") {
							var str = new Date(res[key])
									.format("yyyy-MM-dd hh:mm:ss");
							document.getElementById(key).value = str.split(" ")[1];
						} else if (pagid == "chkDate") {
							document.getElementById(key).value = new Date(res[key])
									.format("yyyy-MM-dd");
						} else if (pagid == "scount" || pagid == "temperature1"
								|| pagid == "pa1" || pagid == "temperature2"
								|| pagid == "pa2" || pagid == "acc"
								|| pagid == "xcount"
								|| pagid == "xtemperature1" || pagid == "xpa1"
								|| pagid == "xtemperature2" || pagid == "xpa2"
								|| pagid == "xacc") {
							document.getElementById(key).value = returnFloat(res[key]);
						} else {
							document.getElementById(key).value = res[key];
						}
					}
				}
			}
		}
	});
});